﻿@model BuildContext
@{
    var project = Model.Project;
    var buildTask = Model.Build;
    var schema = Model.GetCurrentSchema();
    var table = Model.GetCurrentTable();
    var entity = Model.GetEntityContext().FindEntity(schema, table);
}
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Bing.Webs.Controllers;
using @(Model.GetServiceName("Abstractions"));

namespace @($"{project.Module}.Apis.{schema.Name}")
{
    /// <summary>
    /// @entity.Description 控制器
    /// </summary>
    public class @(entity.ClassName)Controller : ApiControllerBase
    {
        /// <summary>
        /// @(entity.Description) 服务
        /// </summary>
        public I@(entity.ClassName)Service @(entity.ClassName)Service { get; }
    
        /// <summary>
        /// @(entity.Description) 查询服务
        /// </summary>
        public IQuery@(entity.ClassName)Service Query@(entity.ClassName)Service { get; }

        /// <summary>
        /// 初始化一个<see cref="@(entity.ClassName)Controller"/>类型的实例
        /// </summary>
        /// <param name="service">@(entity.Description)服务</param>
        /// <param name="queryService">@(entity.Description)查询服务</param>
        public @(entity.ClassName)Controller( I@(entity.ClassName)Service service, IQuery@(entity.ClassName)Service queryService)
        {
            @(entity.ClassName)Service = service;
            Query@(entity.ClassName)Service = queryService;
        }
    }
}